class Person{
    private name:string;
    age:number;
    constructor(name:string,age:number){
        this.name = name;
        this.age = age;
    }

    getInfo():string{
        return `${this.name}-${this.age}`
    }
}

let p1 = new Person('lili',18);

// console.log(p1.name)

console.log(p1.getInfo());

//继承
class Student extends Person{
    constructor(name:string,age:number){
        super(name,age)
    }

    skill(){
        // console.log(`${this.name}学习`)
    }
}

/**
 * private : 私有    只能类内部访问，在子类和实例上不能访问
 * protected:受保护  只能在类内部和子类中访问
 * public: 公共的    在类内部和子类、实例上都能访问到
 * */ 

 let s1 = new Student('tom',19);

s1.skill()